package com.godofball.todo.controller;


import com.godofball.todo.entity.User;
import com.godofball.todo.entity.utils.ResponseResult;
import com.godofball.todo.service.UserService;
import com.godofball.todo.utils.JwtHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * ç”¨æˆ·è¡¨(User)表控制层
 *
 * @author makejava
 * @since 2024-01-01 19:28:34
 */
@RestController
@RequestMapping("user")
@Slf4j
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public ResponseResult login(@RequestBody User user){
        log.info(user.toString());
        return userService.login(user);
    }

    @GetMapping("/info")
    public ResponseResult info(String token){
        return userService.info(token);
    }

    @PostMapping ("/logout")
    public ResponseResult logout(){
        return userService.logout();
    }


}

